package SelectLessonData;

import java.rmi.RemoteException;
import java.util.ArrayList;

import junit.framework.Assert;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import po.SelectLessonPO;

import vo.SelectLessonVO;
import SelectLessonBL.SelectLessonController;
import error.DoubleSelectException;
import error.QualificationException;
import error.TimeException;

public class TestSelecLessonData extends TestCase
{

	private SelectLessonDataController slc;

	@Before
	public void setUp() throws Exception
	{
		slc = new SelectLessonDataController();
	}

	@After
	public void tearDown() throws Exception
	{
	}

	@Test
	public void testInsert() throws RemoteException
	{

		SelectLessonPO temp = new SelectLessonPO();
		temp.lesson = "test001";
		temp.student = "test001";
		temp.pass = false;

		assertTrue(slc.Insert(temp));
	}
	
	@Test
	public void testRemove() throws RemoteException
	{
		
		SelectLessonPO temp = new SelectLessonPO();
		temp.lesson = "test001";
		temp.student = "test001";
		temp.pass = false;
		
		
		assertTrue(slc.Remove(temp));
		
		
	}
	
	@Test
	public void testGet() throws RemoteException
	{
		SelectLessonPO temp = new SelectLessonPO();
		temp.lesson = "test001";
		temp.student = "test001";

		ArrayList<SelectLessonPO> temple = slc.Get(temp);
		assertTrue(temple.get(0).student.equals(temp.student));
		assertTrue(temple.get(0).lesson.equals(temp.lesson));
		
	}
}
